﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebUI.Models;
namespace WebUI.Controllers
{
    public class FollowController : Controller
    {
        public ActionResult Follow(int albumId, int action_type)
        {
            Beauty.Model.user user;
            if (!CommonMethod.CheckLogin(out user))
            {
                return Json(new { error_code = 1, msg = "请先登录" });
            }
            bool flag = false;
            flag = action_type == 1 ? CommonMethod.AddCollection(user.Uid, albumId) : CommonMethod.RemoveCollection(user.Uid, albumId);
            if (flag)
            {
                return Json(new { error_code = 0, msg = "成功" });
            }
            else
            {
                return Json(new { error_code = 2, msg = "失败" });
            }
            //if (action_type == 1)
            //{
            //    if (CommonMethod.AddCollection(user.Uid, albumId))
            //    {
            //        flag = true;
            //    }
            //    else
            //    {
            //        flag = false;
            //    }
            //}
            //else
            //{
            //    if (CommonMethod.RemoveCollection(user.Uid, albumId))
            //    {
            //        flag = true;
            //    }
            //    else
            //    {
            //        flag = false;
            //    }
            //}

        }

    }
}